<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>isNaN()函数：判断一个变量是不是NaN</p>
    <script>
        let a = NaN;
        let b = 12 / 0;
        console.log(b); // Infinity


        console.log("typeOf NaN = ",typeof NaN); // number
        console.log("typeOf Infinity = ",typeof Infinity); // number

        // isNaN函数：判断一个变量是不是 NaN
        let r = isNaN(a);
        console.log(r); // true

        r = isNaN(b);
        console.log(r); // false

        let str = "123.0";
        r = isNaN(str);
        // js是弱语言数据类型，数据类型会自动转变，该字符串可以转变数值
        console.log(r); // false

        str = "我123";
        r = isNaN(str);
        console.log("我123 = ",r); // true

        let boo = true;
        r = isNaN(boo);
        // js是弱语言数据类型，数据类型会自动转变，布尔可以转变数值，true=1 false=0
        console.log(r); // false


    </script>
</body>
</html>